<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ page import="java.io.*, java.sql.*, java.util.*,LS.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib tagdir="/WEB-INF/tags" prefix="my" %>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form"%>

<%
	request.setCharacterEncoding("utf-8");
%>
<!DOCTYPE html>
<html lang="UTF-8">
<style>
.b:hover {
	background-color: black;
	color: white;
	cursor: pointer;
}

th,td {
	padding-bottom: 5px;
	padding-top: 5px;
}

h4,h1 {
	margin: 0px;
	padding: 0px;
}

th {
	height: 30px;
	border-right: 1px solid #e5e5e5;
	border-bottom: 1px solid #e5e5e5;
}

tr {
	border-bottom: 1px solid #e5e5e5;
}

table {
	width: 90%;
}

#outerview {
	padding-top: 10px;
	margin-left: 0px;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

#outerview {
	width: 100%;
	min-height: 600px;
	padding: 0px;
	padding-bottom: 20px;
}

#middleview {
	width: 90%;
	min-height: 450px;
	margin: 0px auto 0px auto;
	left: 50%;
}

#innerview {
	width: 100%;
	min-height: 100%;
	text-align: center;
	background-color: #fff;
	border: 1px solid #e5e5e5;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
	box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

#plusview {
	margin: 10px;
	margin-bottom: 0px;
}

.tableview {
	width: 100%;
	max-height: 100%;
	left: 50%;
}

.lending,.reservation {
	width: 12%
}

.l,.r {
	width: 8%;
}
</style>

<head>
<meta charset="utf-8">
<title>성공회대학교 기자재 대여 시스템</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">


<script src="assets/js/bootstrap.min.js"></script>


<!-- styles시트 -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="assets/css/docs.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/bootstrap.css">
<script type="text/javascript" src="assets/js/bootstrap.js"></script>
<script type="text/javascript">
		$(document).ready(function() {
			$('.dropdown-toggle').dropdown();
		});
	</script>

<script type="text/javascript"
	src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script type="text/javascript" src="assets/smartPop/jquery.smartPop.js"></script>
<link rel="stylesheet" href="assets/smartPop/jquery.smartPop.css" />
<script type="text/javascript">
	$(document).ready(
			function() {
				$('.b').click(
						function() {
							
							item_name = $(this).attr('id');
							model_name = $(this).attr('name');
							cnt = $(this).attr('value');
							using = $('#using').val();
							
							 
							$.smartPop.open({
								width : 900,
								height : 700,
								url : 'smartPop.do?a=write&item_name='
										+ item_name + '&model_name='
										+ model_name + '&using=' + using + '&cnt=' +cnt
							});
						});
				$('.dropdown-toggle').dropdown();
			}, function() {
				$('.abc').click(
						
						function() {
							alert("abc");
						});
			});
	
	function smartPopClose() {
		$.smartPop.close();
	}
	
	
	function pageMove(num) {
		alert("pageMove(num)");
		$('#page').val($(num).text());
		$('#frm1').submit();
	}
	
</script>


</head>

<body data-spy="scroll" data-target=".bs-docs-sidebar">



	<!-- 메뉴
    ================================================== -->
	<%
		if (session.getAttribute("user") == null) {
	%>
	<jsp:include page="/top.do"></jsp:include>
	<%
		} else {
			Users u = (Users) session.getAttribute("user");
			if (u.getUser_position().equalsIgnoreCase("S")) {
	%>
	<!-- 학생이 로그인 했을 경우 메뉴 -->
	<jsp:include page="/studenttop.do"></jsp:include>
	<%
		} else if (u.getUser_position().equalsIgnoreCase("P")) {
	%>
	<!-- 교수가 로그인 했을 경우 메뉴 -->
	<jsp:include page="/teachertop.do"></jsp:include>
	<%
		} else {
	%>
	<!-- 관리자가 로그인 했을 경우 메뉴 -->
	<jsp:include page="/managertop.do"></jsp:include>
	<%
		}
		}
	%>
	<!-- 게시판
    ================================================== -->
	<div style="text-align: center">
		<div class="marketing"
			style="margin-bottom: 30px; color: #000; text-align: left">
			<div class="container">
				<h3 style="margin: 10px; font-size: 35px;">
					<strong>실습용 기자재 대여</strong>
				</h3>
			</div>
		</div>
	</div>
	<input id="using" type="hidden" value="${ using }">
	<div class="container">
		<div id="outerview">
			<div id="middleview">
				<div id="plusview">
					<div class="control-gruop" style="text-align: left;">
						
						<sf:form id="frm1" method="post" modelAttribute="vwEI">
							<div class="controls">
								
								<h4 style="font-size: 13px">
								
									<!-- 400 에러 -->
									<sf:checkbox path="dId" name="dId" value="1" class="checkbox" />&nbsp;우리 과 기자재만
									
									검색&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <sf:checkbox path="lending_state" name="lending_state"
										value="0" class="checkbox" />&nbsp;대여
									가능한 기자재만 검색
									 
								</h4>
								
								<sf:hidden path="using_id" name="using_id" value="2" /> <sf:select
									path="kind" name="kind" id="select01" style="width: 100px;" >
									<sf:option value="0">전체</sf:option>
									<sf:option value="1">물품명</sf:option>
									<sf:option value="2">모델명</sf:option>
								</sf:select>
								
								<sf:input path="item_name" name="item_name" class="input-medium" />
								<input type="submit" id="c" name="c" class="btn"
									value="검색" style="vertical-align: top;">
								<!--
								<button type="button" class="btn" style="float: right; margin-bottom: 5px">우리 과 대여가능 실습용
									기자재 보기</button>
								 -->
							</div>
							
							<input type="hidden" id="page" name="pg">
							
						</sf:form>
						
					</div>
				</div>
				<div id="innerview">
					<table class="tableview">
						<tr>
							<th style="width:20%">물품명</th>
							<th style="width:35%">모델명</th>
							<th style="width:35%">해당 학과</th>
							<th style="width:10%" class="lending">대여가능<br>갯수
							</th>
						</tr>
						
						<c:forEach var="e" items="${equipments}">
							<tr class="b" id="${e.item_name}" name="${e.model_name}" value="${e.cnt}">
								<td class="a">${e.item_name}</td>
								<td class="a">${e.model_name}</td>
								<td class="a">${e.departments_name}</td>
								<td class="a">${e.cnt}</td>
						</c:forEach>
					</table>
					
					<div>
					    <my:pager2 pageSize="${ pageSize }" recordCount="${ recordCount }" />
					</div>
				</div>
			</div>
		</div>
	</div>
		<%= (Integer)request.getAttribute("page") %>
		
	<!-- 꼬리말
    ================================================== -->
	<footer class="footer">
		<div class="container">
			<p>Copyright SKHU. Software Student.</p>
		</div>
	</footer>
	<script type="text/javascript" src="assets/js/bootstrap.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$('.dropdown-toggle').dropdown();
		});
	</script>
</body>
</html>
